/**
 * URLFetchException.java
 * 
 * FreeZzaph is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * FreeZzaph is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.
 */
package freezzaph.exceptions;

import java.net.URL;


/**
 * Exception thrown by the URLFetchers to indicate
 * that there was a problem fetching an URL.
 * 
 * @author FreeZzaph
 */
public class URLFetchException extends Exception {
	
	private URL url;
	
	/**
	 * Construct an exception with the given
	 * detail message and offending URL.
	 *  
	 * @param message the message detailing why
	 * this exception is thrown.
	 * @param url the URL that caused the
	 * exception to be thrown.
	 */
	public URLFetchException(String message, URL url) {
		super(message);
		this.url = url;
	}
	
	/**
	 * Construct an exception with the given
	 * detail message, cause, and offending URL.
	 *  
	 * @param message the message detailing why
	 * this exception is thrown.
	 * @param cause the reason why this exception
	 * was thrown.
	 * @param url the URL that caused the
	 * exception to be thrown.
	 */
	public URLFetchException(String message, Throwable cause, URL url) {
		super(message, cause);
		this.url = url;
	}

	/**
	 * Returns the URL that caused this exception.
	 * 
	 * @return the URL that caused this exception.
	 */
	public URL getOffendingUrl() {
		return url;
	}

}
